<template>
  <div>
    <el-row>
      <el-col :span="8" :offset="8">
        <p>
          您本次注册的用户名为：{{ username }}
        </p>
        <p>
          您本次注册的密码为：<small v-if="show">{{ password }}</small><small v-if="!show">***********</small> <el-button @click="changeShow" icon="el-icon-view">显示密码</el-button>
        </p>
        <el-button @click="login">登录</el-button>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8" :offset="8">
        <span style="color: red">
          注：本站将不会再为您显示这些信息。请注意保存！！
        </span>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'RegisterSuccess',
  data () {
    return {
      username: this.$route.params.username,
      password: this.$route.params.password,
      id: this.$route.params.id,
      show: false
    }
  },
  mounted () {
    if (!this.$route.params.id) {
      this.$router.replace({
        name: '404'
      })
    }
  },
  methods: {
    changeShow () {
      this.show = !this.show
    },
    login () {
      this.$router.replace({ path: '/' })
    }
  }
}
</script>

<style scoped>

</style>
